<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>愉直播</title>

	<style>
		html {
			font-family: "Helvetica Neue", Helvetica, sans-serif;
			font-size: 20px;
		}

		html,
		body {
			-webkit-touch-callout: none;
			-webkit-text-size-adjust: none;
			-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
			-webkit-user-select: none;
			width: 100%;
			margin: 0;
			border: 0;
			padding: 0;
			font-style: normal;
		}

		body {
			line-height: 1.5;
			font-size: 0.8rem;
			color: #fff;
			/*background: #000 !important;*/
			background: url('www_suxiangw_com/i/bg.gif');
			outline: 0;
		}

		.a {
			position: fixed;
			top: 40%;
			right: 0;
			left: 0;
			bottom: 0;
			text-align: center;
			display: block;
		}

		.a img {
			margin: 0 auto;
			text-align: center;
			width: 8.8rem;
		}

		.a p {
			text-align: center;
			font-size: 0.85rem;
			padding-top: 0.55rem;
		}

		.a p b {
			color: #f00;
			font-size: 1.3rem;
		}

		#loadingdi_huifu-s {
			display: flex;
			width: 100%;
			justify-content: center;
			align-items: center;
			height: 500px;
			text-align: center;
			margin: 0 auto;
			flex-direction: column;
		}

		#loadingdi_huifu-s img {
			-webkit-animation: rotation .65s 0s linear infinite;
			animation: rotation .65s 0s linear infinite;
			display: inline-block;
		}

		@-webkit-keyframes rotation {
			0% {
				-webkit-transform: rotate(0deg) scale(1);
				transform: rotate(0deg) scale(1)
			}
			50% {
				-webkit-transform: rotate(180deg) scale(.6);
				transform: rotate(180deg) scale(.6)
			}
			100% {
				-webkit-transform: rotate(360deg) scale(1);
				transform: rotate(360deg) scale(1)
			}
		}

		#loadingdi_huifu-s img {
			width: 2rem;
			height: 2rem;
		}

		#loadingdi_huifu-s div {
			padding-top: 1rem;
			font-size: 0.8rem;
			text-shadow:1px 2px 5px #fff;
			line-height: 1.5rem;
		}
	</style>
</head>
<body>
	<div id="loadingdi_huifu-s">
		<img src="www_suxiangw_com/i/footer_progress.png" />
		<!-- <div>出售APP短视频源码<br />微信/电话: 156 2228 9461</div> -->
	</div>
</body>
<script type="text/javascript" src="www_suxiangw_com/j/crypto-js.js"></script>
<script type="text/javascript" src="www_suxiangw_com/j/zepto.min.js"></script>
<script type="text/javascript" src="www_suxiangw_com/j/api.js"></script>
<script type="text/javascript" src="www_suxiangw_com/j/suxiangw.js"></script>
<script type="text/javascript" src="www_suxiangw_com/j/ad.js"></script>
<script type="text/javascript">
	var _root_name = 'index_list_1',
		rong, aMapLBS, _root = 0,
		pause_start = true,
		time, likaitime = 15000,notification;
	apiready = function() {
		_init_ad();
		_removePrefs('index_video_loading');
    // _uot()
		api.addEventListener({
			name : 'smartupdatefinish'
		}, function(ret, err) {
			_alert('APP自动修复完成，需要重启APP才能生效');
			api.rebootApp();
		});

		_heibai();
		$api.css($api.byId('loadingdi_huifu-s'), 'height:' + (api.winHeight - 100) + 'px');
		api.removeLaunchView();

		// 回到屏幕
		api.addEventListener({
			name: 'viewappear'
		}, function(ret, err) {
			 _userInfo();
		});
		// 离开屏幕
		api.addEventListener({
			name: 'viewdisappear'
		}, function(ret, err) {
			//  _userInfo();
		});
		//应用进入后台事件
		api.addEventListener({
			name: 'pause'
		}, function(ret, err) {
			time = Date.parse(new Date());
			time = time + likaitime
			_setPrefs('ad_time', time);
			//  _userInfo();
		});
		// console.log(_getPrefs('_config').ad.kaiping)
		// 应用从后台回到前台事件
		api.addEventListener({
			name: 'resume'
		}, function(ret, err) {
			_userInfo();
			time = Date.parse(new Date());
			if(_getPrefs('ad_time')){
				if(_getPrefs('_config') && _getPrefs('_config').config.app == 1){
					return;
				}
			///	console.log(_getPrefs('_config').ad.kaiping+":"+ad_vip)
				if(time > _getPrefs('ad_time')){
					// console.log(time +" : "+ _getPrefs('ad_time'))
					if(_getPrefs('_config').ad.ad){
						if(_getPrefs('_config').ad.kaiping == 1 && ad_vip){
							 ad_kaiping();
						}else if(_getPrefs('_config').ad.kaiping == 2 && ad_vip){
							setTimeout(function(){
								_url({animation:true,js:'kaiping'},'ad');
							},100)
						}
					}
				}
			}
			sendNotification(1);
			// console.log('后台')
		});
		// 融云
		rong = api.require('rongCloud2');


		//		return _url({},'c');
		config();
		aMapLBS = api.require('aMapLBS');
		// 状态栏
		// 监听弹窗消息
		api.addEventListener({
		    name: 'msg'
		}, function(ret, err) {
		    console.log(JSON.stringify(ret.value));
				var a = ret.value;
				tan(a.url,a);
		});
	}

	function config() {
		_ajax('video/config', function(ret, err) {
			//  console.log(JSON.stringify(ret)+JSON.stringify(err))
			if (ret) {
				ret.config.app = 0;
				_setPrefs('_config', ret);
				// console.log(JSON.stringify(_getPrefs('_config').typeids))
				if(api.systemType == 'ios'){
				}else{
					// notification = api.require('customNotification');
					// sendNotification();
				}
				if(ret.ad.ad){
					// 初始化广告
					if(adName){
						ad = api.require(adName);
						init();
					}
					if(ret.ad.kaiping == 1 && ad_vip){
						ad_kaiping();
					}
				}

				// return 	_url({animation:true,bgColor:'#fff',video:'/private/var/mobile/Containers/Data/Application/C4578362-0ECE-4701-9394-B3CA54E5705D/tmp/9DB42276-02A7-477B-8F45-6D33355466A7-21996-000008FFF21682BB.MOV'},'article_member_add_win');
				// return _url({url:'video_view_win'});
				//  return _index_win('fang');
						//  console.log(JSON.stringify(ret.hongbao));
				win();
				//	_userInfo();
				// 界面

				// 视频
			} else {
				// console.log(JSON.stringify(err));
				$('#loadingdi_huifu-s div').text(err.msg);
				setTimeout(function() {
					config();
				}, 500)
			}
		})
	};

	function win() {
		if (!_getPrefs('yinsi_' + api.appVersion)) {
			var name = 'yinsi';
			api.openFrame({
				name: name,
				url: _h_w + name + '.html',
				bounces: false,
				reload: true,
				bgColor: 'rgba(0,0,0,0)',
				rect: {
					x: 0,
					y: 0,
					w: 'auto',
					h: 'auto'
				}
			})
			return;
		}


		// 动态权限开始

		if (api.systemType == 'android') {
			api.requestPermission({
				list: ['phone', 'camera', 'microphone', 'photos', 'location', 'notification', 'storage']
			});
			// api.hasPermission({
			// 	list: ['phone', 'camera', 'microphone', 'photos', 'location', 'notification', 'storage']
			// });
		}
		var name = 'suxiangw_com';
		//	alert(_h_w+name+'.html')
		api.openFrame({
			name: name,
			url: _h_w + name + '.html',
			bounces: false,
			reload: true,
			bgColor: 'rgba(0,0,0,0)',
			rect: {
				x: 0,
				y: 0,
				w: 'auto',
				h: 'auto'
			}
		})
		// 在登录状态下执行融云初始化
		if (_getPrefs('_user') && _getPrefs('_user').vip) {
			// console.log('userL:'+JSON.stringify(_getPrefs('_user')))
			rongyun_init();
		}

		// index_header();
		// index_footer();
		// var name = ['index_list', 'index_list'];
		// var frames = [];
		// for (var i = 0; i < name.length; i++) {
		// 	var frame = {};
		// 	frame.name = name[i] + '_' + i;
		// 	frame.url = _h_w + name[i] + '.html';
		// 	frame.bgColor = 'rgba(0,0,0,0)';
		// 	frame.pageParam = {
		// 		name: name[i],
		// 		index: i,
		// 	}
		// 	frames.push(frame);
		// }
		// openFrameGroup(frames);

	}

	function openFrameGroup(frames) {
		//console.info(JSON.stringify(frames))
		api.openFrameGroup({
			name: 'index',
			bounces: false,
			rect: {
				x: 0,
				y: 0,
				w: 'auto',
				h: 'auto',
			},
			frames: frames,
			index: 1,
			preload: 0, // 预加载的 frame 个数，默认加载当前页后面一个
		}, function(ret, err) {
			api.bringFrameToFront({
				// from: 'index_header',
			});
			api.bringFrameToFront({
				// from: 'index_footer',
			});
			if (ret.name) {
				_root_name = ret.name;
			}

			if (_root) {
				// api.execScript({
				// 	frameName: 'index_list_'+ret.index,
				// 	script: 'video_loading(1)'
				// });
				api.execScript({
					frameName: 'index_list_' + ret.index,
					script: 'pay_url()'
				});
				api.execScript({
					// frameName: 'index_header',
					script: 'cla(' + ret.index + ')'
				});
				setTimeout(function() {
					if (ret.index == 1) {
						api.execScript({
							frameName: 'index_list_0',
							script: 'video_img_t()'
						});
						api.execScript({
							frameName: 'index_list_1',
							script: 'video_img()'
						});
					} else if (ret.index == 0) {
						api.execScript({
							frameName: 'index_list_1',
							script: 'video_img_t()'
						});
					}
				}, 300)
			}
			_root = 1;

			//	console.log(ret.index)

		});


	}

	// 融云开始

	// 融云初始化
	function rongyun_init() {
		rong.init(function(ret, err) {
			if (ret.status == 'success') {
				// 设置接收消息的监听器
				setOnReceiveMessageListener();
				//	设置连接状态变化的监听器
				// rong.setConnectionStatusListener(function(ret, err) {
				// 	if(ret){
				// 		console.log("监听ret："+JSON.stringify(ret))
				// 	}else{
				// 		console.log("监听err："+JSON.stringify(err))
				// 	}
				// });
				// 设置 connect
				rong_token();
				//					if(_getPrefs('rong_token')){
				//						rong_connect(_getPrefs('rong_token').token);
				//					}else{
				//						rong_token();
				//					}
				// 设置本地消息不提示
				//					rong.disableLocalNotification(function(ret, err) {
				//						if(ret){
				//						//	console.log("设置本地消息不提示："+JSON.stringify(ret))
				//						}else{
				//							console.log("设置本地消息不提示："+JSON.stringify(ret))
				//						}
				//					})
				//		console.log("初始化成功："+JSON.stringify(ret))
				// 消息数量


			} else if (ret.status == 'error') {
				console.log('初始化错误：' + JSON.stringify(err))
			}
		});
	}
	// 连接融云 IM 服务器，进行后续各种方法操作前务必要先调用此方法
	function rong_connect(tokens) {
		// return;
		if (!tokens) {
			alert("tokens不能为空");
			return
		}
		rong.connect({
			token: tokens
		}, function(ret, err) {
			if (ret.status == 'success') {
						console.log('获取用户成功:'+JSON.stringify(ret))
			} else {
				console.log('获取用户失败:' + JSON.stringify(err));
				return console.log(_cuowu(err.code))
			}
		});
	}
	// 获取token
	function rong_token() {
		if (!_getPrefs('_token',true)) {
			console.log('用户未登录，无法设置融云设置 connect')
			return;
		}
		_ajax('rong/token', function(ret, err) {
							console.log('err:'+JSON.stringify(err))
			if (ret) {
							console.log('token:'+JSON.stringify(ret))
				if (ret.token) {
					_setPrefs('rong_token', ret);
					//  设置 connect
					rong_connect(ret.token)
				} else {
					//	_alert(ret.err)
				}
			} else {
				_alert(JSON.stringify(err))
			}
		})
	}
	// 退出登录并且注销
	function index_uot() {
		// if (!_getPrefs('_user')) {
		// 	return;
		// }
		$api.rmStorage('_token')
		$api.rmStorage('_user')
		$api.rmStorage('rong_token')
		_user = ''
		_token = '';
		api.closeFrame({
		    name: 'time'
		});
		// 注销融云
		rong.logout(function(ret, err) {
			if (ret.status == 'success') {
				console.log('融云注销成功')
			} else {
				console.log('融云注销失败')
			}
		}); // 断开，且不再接收 Push

	}
	// 错误提示
	function _cuowu(msg) {
		if (msg == '-10002') {
			return ('输入参数错误，错误码：' + msg)
		}
		switch (msg) {
			case '30014':
				return ('发送处理失败，错误码：' + msg)
				break;
			case '30003':
				return ('服务器超时，错误码：' + msg)
				break;
			case '31009':
				return ('用户被屏蔽，错误码：' + msg)
				break;
			case '-10000':
				return ('未调用 init 方法进行初始化，错误码：' + msg)
				break;
			case '-10001':
				return ('未调用 connect 方法进行连接，错误码：' + msg)
				break;
			case '-10002':
				return ('输入参数错误，错误码：' + msg)
				break;
			default:
				return ('用户在黑名单中，错误码：' + msg);
		}
	}
	//  获取所有未读消息数
	function getTotalUnreadCount() {
		if (!_getPrefs('_user')) {
			return;
		}
		rong.getUnreadCountByConversationTypes({
			conversationTypes: ['PRIVATE']
		}, function(ret, err) {
			// 传播出去
			// return; // 暂停传播消息数字
			api.sendEvent({
				name: 'xiaoxi',
				extra: {
					money: ret.result,
				}
			});
		})
	}
	// 设置接收消息的监听器
	function setOnReceiveMessageListener() {
		rong.setOnReceiveMessageListener(function(ret, err) {
			console.log("监听消息ret：" + JSON.stringify(ret))
			if (ret.result.message) {
				// 收到消息传播出去
				getTotalUnreadCount();
				// 消息页传播内容
				api.sendEvent({
					name: 'xiaoxi_data',
					extra: ret.result.message
				});
			}
		})
	}
	// 融云结束
	// 定位


	function shuaxin() {
		api.execScript({
			frameName: _root_name,
			script: 'shuaxin();'
		});
	}
	// 上一个视频
	function slidePrev() {
		api.execScript({
			frameName: _root_name,
			script: '_slidePrev()'
		});
	}
	// 下一个视频
	function slideNext() {
		api.execScript({
			frameName: _root_name,
			script: '_slideNext()'
		});
	}
	// 删除视频
	function dandel() {
		api.execScript({
			frameName: _root_name,
			script: '_dandel()'
		});
	}
	// 广告
	function ad_kaiping(){
		if(_getPrefs('app') == 1){
			return;
		}
//			$api.rmStorage('ad')
//				$api.rmStorage('adimage')
		if(_getPrefs('ad') && _getPrefs('adimage')){
			api.openWin({
				name : 'ad_kaiping',
				url : _h_w+'ad_kaiping.html',
				reload:true,
				bounces:false,
				animation:{
					type:"none",                //动画类型（详见动画类型常量）
					subType:"from_bottom",       //动画子类型（详见动画子类型常量）
					duration:300
				},
			});
		}else{
			adAjax()
		}
	}
	function adAjax(){
		_ajax('ad/view',function(ret,err){
			if(ret){
			//	console.log(JSON.stringify(ret.ret));
				if(ret.ret.data){
					_setPrefs('ad', ret.ret);
					console.log(api.winName+'开始缓存：'+_sx_qiniu+ret.ret.data.img)
					api.imageCache({
						url : _sx_qiniu + ret.ret.data.img+'?imageView2/1/w/'+api.winWidth+'/h/'+api.winHeight+'/format/jpg',
						thumbnail:false,
					}, function(ret, err) {
						if (ret) {
							if (ret.status) {
								console.log(api.winName+'缓存成功'+ret.url);
								_setPrefs('adimage', ret.url);
							}else{

							}
						}else{
							console.log('缓存失败'+JSON.stringify(err));
						}
					});
					return;
				}else{
					console.log('没有获取到哦')
				}
			}else{
				console.log(JSON.stringify(ret));
			}
			$api.rmStorage('ad')
			$api.rmStorage('adimage')
		})
	}
	// 获取状态栏数据
	function sendNotification(type){
		return;
		if(api.systemType == 'ios'){
			return;
		}
		_ajax('renwu/notification',function(ret,err){
			if(ret){
				if(type == 1){
					notification.updateNotification(ret);
				}else{
					notification.sendNotification(ret);
				}
			}else{
				_alert(JSON.stringify(err));
			}
		})
	}

</script>

</html>
<!-- 5Y2X5piM6YCf57+U572R57uc56eR5oqA5pyJ6ZmQ5YWs5Y+4IA0KUVHmioDmnK/vvJoxNDI0NDQ1NjA4ICAg55S16K+dL+W+ruS/oe+8mjE1NjIyMjg5NDYxDQror7fliqHlv4XlsIrph43nn6Xor4bkuqfmnYMg5Lil5qC85L+d6K+B5LiN5oG25oSP5Lyg5pKt5Lqn5ZOB5rqQ56CB44CB5LiN5b6X55u05o6l5a+55Lqn5ZOB5pys6LqrDQrov5vooYzkuozmrKHovazllK7miJblgJLljZbjgIHkuI3lvpflr7nkuqflk4Hov5vooYznroDljZXljIXoo4XlkI7lo7Dnp7DkuLroh6rlt7HnmoTkuqflk4HnrYnjgIINCkNvcHlyaWdodCAoYykgMjAxOC0yMDE5IGh0dHA6Ly93d3cuc3V4aWFuZ3cuY29tLyBBbGwgcmlnaHRzIHJlc2VydmVkLg== -->
